import type { ResponseOption } from "../../res/ResponseOption.js";
import { fields, ResOp } from "./utils.js";

export const loadAsset: ResponseOption = {
    name: "0x00 02 加载资源",
    description: "加载资源",
    fields: [
        fields.op(ResOp.LoadAsset),
        fields.crc,
        fields.length,
        {
            name: "资源内容",
            kind: "custom",
            desc: "资源的具体内容",
            matcher(data) {
                const len = data.length;
                const str = data.hex(len);
                data.consume(len);
                return len + " byte\n" + str;
            },
        },
    ],
};
